package com.zh.operation.service.impl;

import com.zh.common.domain.DictDO;
import com.zh.operation.dao.OperationGoodsBuyDao;
import com.zh.operation.domain.OperationGoodsBuyDO;
import com.zh.operation.service.OperationGoodsBuyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;


@Service
public class OperationGoodsBuyServiceImpl implements OperationGoodsBuyService {
	@Autowired
	private OperationGoodsBuyDao operationGoodsBuyDao;
	
	@Override
	public OperationGoodsBuyDO get(String id){
		return operationGoodsBuyDao.get(id);
	}
	
	@Override
	public List<OperationGoodsBuyDO> list(Map<String, Object> map){
		return operationGoodsBuyDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return operationGoodsBuyDao.count(map);
	}
	
	@Override
	public int save(OperationGoodsBuyDO goodsBuy){
		goodsBuy.setId(new SimpleDateFormat("yyyyMMddHHmmssSS").format(new Date())+(int)((Math.random()*9+1)*1000));
		goodsBuy.setCreateDate(new Date());
		goodsBuy.setDelFlag("0");
		return operationGoodsBuyDao.save(goodsBuy);
	}
	
	@Override
	public int update(OperationGoodsBuyDO goodsBuy){
		return operationGoodsBuyDao.update(goodsBuy);
	}
	
	@Override
	public int remove(String id){
		return operationGoodsBuyDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return operationGoodsBuyDao.batchRemove(ids);
	}

	@Override
	public List<DictDO> getType() {
		return operationGoodsBuyDao.getType();
	}

}
